package exec;

public class Exec03_1 {

    public static void main(String[] args) {
        // 给定一个整数数组，编写一个程序，移除数组中的重复元素，输出一个去重后的数组
        int[] arr = {12, 23, 34, 19, 25, 17, 23, 17, 19};
        int max = arr[0];
        for (int i = 1; i < arr.length; i++) {
            max = max < arr[i] ? arr[i] : max;
        }
        // newArr[12] = 2   newArr[23]
        int[] newArr = new int[max + 1];

        for (int i = 0; i < arr.length; i++) {
            newArr[arr[i]] ++;
        }
        int[] arr2 = new int[arr.length];
        int k = 0;
        for (int i = 0; i < newArr.length; i++) {
            if (newArr[i] != 0) {
                arr2[k] = i;
                k ++;
            }
        }

        for (int i = 0; i < k; i++) {
            System.out.println(arr2[i]);
        }
//
    }
}
